import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:ls_work/message/message_config.dart';
import 'package:ls_work/net/response/use_request/use_request_list_data.dart';

import '../../model/use_request/use_request_model.dart';

class UseRequestRecordViewModel extends BaseListViewModel<UseRequestListData>{
  UseRequestRecordViewModel(BuildContext context) : super(context);

  var model = UseRequestModel();
  @override
  Future<List<UseRequestListData>> requestListData() async {
    return await model.requestRecord(rows: pageLength, page: page);
  }


  @override
  void onCreated() {
    super.onCreated();
    requestRefresh(showAni: false);
  }


  @override
  void receiveMessage(SendMessageEvent event) {
    super.receiveMessage(event);
    if(event.msgCode==MessageConfig.ADD_REQUEST_SUCCESS){
      requestRefresh(showAni: true);
    }
  }
}